<!DOCTYPE html>
<html>
    <head>
        <title>单击、双击事件练习</title>
        <meta charset="utf-8">
        <script language="JavaScript"> 
		    var clickBtn = document.getElementById("clickBtn1");
		    var clickTimer = null;
		    function btnClick(e) {
		        clearTimeout(clickTimer);  //首先清除计时器
		        clickTimer = setTimeout(() => {
		            alert("你点击了我");
		        },300);
		    }
		 
		    function btndbClick(e) {
		        clearTimeout(clickTimer);
		       alert("你双击了我");
		    }
        </script>
    </head>
    <body>
       <button id="clickBtn1" onclick="btnClick()" ondblclick="btndbClick()">点我</button>
    </body>
</html>